<?php


namespace BoojasrFramework\Loader;

use Symfony\Component\Routing\Loader\AnnotationClassLoader;
use Symfony\Component\Routing\Route;

/**
 * Class AnnotationRouteAnnotationClassLoader
 */
class AnnotationRouteAnnotationClassLoader extends AnnotationClassLoader
{

  /**
   * 配置路由
   * @param Route $route
   * @param \ReflectionClass $class
   * @param \ReflectionMethod $method
   * @param $annot
   */
  protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot)
  {
    // 设置_controller
    $controller_default = $method->class."::".$method->name;
    $route->setDefault("_controller",$controller_default);
  }

  protected function createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition)
  {
    return parent::createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition);
  }
}
